import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/SetRefresh")
public class SetRefresh extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        resp.setContentType("text/html;charset=utf8");
        //header报头中有一个特殊的键值对，将它设置为你想要
        // 浏览器自动刷新的时间间隔
        resp.setHeader("refresh","1");
        //将当前访问的时间戳写道响应body中
        resp.getWriter().write(System.currentTimeMillis()+"");
    }
}
